home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr14
/
dndprogs.zip
/
NEWNAMES.AWK
< prev
next >
Wrap
Text File
|
1993-04-01
|
627b
|
43 lines
#! /usr/local/bin/nawk -f
BEGIN {
srand()
Count[0] = 0
Section = 0
}
/^%[ ]*$/ {
Section++;
Count[Section] = 0
next
}
/^#.*$/ { next } # ignore comments
/^[ ]*$/ { next } # ignore blank lines
{
Syllables[Section, Count[Section] ] = $0
Count[Section]++
}
END {
for (;;) {
# random from first section
printf "[%s", Syllables[0, Rand(0, Count[0] - 1)]
for (i = 1; i <= Section && i in Count; i++) {
if (Count[i]) {
printf "-%s", Syllables[i, Rand(0, Count[i] - 1)]
}
}
printf "]\n"
}
}
function Rand(min, max)
{
return int((max + 1 - min) * rand()) + min
}